package de.fhb.itunes.repository.data;

import java.sql.Date;

public class MedienFile_VO {
	private int id, trackid;
	private String titel, genre, pfad;
	private long laenge;
	private Date added;

	public MedienFile_VO() {
		super();
	}

	public MedienFile_VO(int id, int trackid, String titel, String genre,
			String pfad, long laenge, Date added) {
		super();
		this.id = id;
		this.trackid = trackid;
		this.titel = titel;
		this.genre = genre;
		this.pfad = pfad;
		this.laenge = laenge;
		this.added = added;
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public int getTrackid() {
		return trackid;
	}

	public void setTrackid(int trackid) {
		this.trackid = trackid;
	}

	public String getTitel() {
		return titel;
	}

	public void setTitel(String titel) {
		this.titel = titel;
	}

	public String getGenre() {
		return genre;
	}

	public void setGenre(String genre) {
		this.genre = genre;
	}

	public String getPfad() {
		return pfad;
	}
	public String getPfadForURL(){
		String pfadUrl = pfad;
		pfadUrl = pfadUrl.replace("&", "%26"); // & zeichen maskiert da & trennzeichen für getparameter
		pfadUrl = pfadUrl.replace("%C3", "ü"); // ü in pfad schreiben damit die pfadauflösung funktioniert
		pfadUrl = pfadUrl.replace("%BC", "");  // fehlzeichen nach dem ü entfernen
		return pfadUrl;
	}

	public void setPfad(String pfad) {
		this.pfad = pfad;
	}

	public long getLaenge() {
		return laenge;
	}

	public void setLaenge(long laenge) {
		this.laenge = laenge;
	}

	public Date getAdded() {
		return added;
	}

	public void setAdded(Date added) {
		this.added = added;
	}

	public boolean equals(Object obj){
		boolean erg = false;
		if(obj != null){
			if(obj instanceof MedienFile_VO){
				MedienFile_VO medi = (MedienFile_VO) obj;
				if(this.added.equals(medi.added)&& this.genre.equals(medi.genre)&& this.id == medi.id && this.laenge == medi.laenge && this.pfad.equals(medi.pfad) && this.titel.equals(medi.titel) && this.trackid == medi.trackid){
						erg = true;
				}
			}
		}
		return erg;
	}
	public String toString() {
		return this.titel;
	}
}
